package sorter;

import java.util.Comparator;
import java.util.TreeSet;

public class SetSorter {
    public static void main(String[] args) {
        TreeSet<Employee> employees
                = new TreeSet<>(new Comparator<Employee>() {
            @Override
            public int compare(Employee o1, Employee o2) {
                return (int) (o1.getSalary() - o2.getSalary());
            }
        });
        employees.add(new Employee("张三", 33, (double) 1801f));
        employees.add(new Employee("张", 34, (double) 1800f));
        employees.add(new Employee("张0", 35, (double) 3800f));
        System.out.println(employees);
    }
}
